﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[fnConfig_IsDatabaseNoArchive]
#-- Purpose:		Is the database running in SIMPLE mode
#--	Last Update:	08/02/2012
#--					For a complete history - please review comments in Version
#--					control.
#-- Called By:		[dbo].[spBkp_Log]
#------------------------------------------------------------------------------
*/
CREATE FUNCTION [dbo].[fnConfig_IsDatabaseNoArchive]
(
	@database_name sysname		= NULL
)
RETURNS BIT
AS
BEGIN
	--- If no database name is passed in, set the Database Name to the current database
	IF ISNULL(@database_name, '') = ''
		SELECT	@database_name = DB_NAME()
		
	--- Return the Answer to the Question
	RETURN	CAST(CASE	WHEN DATABASEPROPERTYEX(@database_name, 'Recovery') = 'SIMPLE'
						THEN 1 ELSE 0 END as bit)
END
